
package cn.edu.scau.cmi.hombio.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.math.BigDecimal;

import java.util.Calendar;
import java.util.Set;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import org.codehaus.jackson.annotate.JsonIgnore;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllFodderTakes", query = "select myFodderTake from FodderTake myFodderTake"),
		@NamedQuery(name = "findFodderTakeById", query = "select myFodderTake from FodderTake myFodderTake where myFodderTake.id = ?1"),
		@NamedQuery(name = "findFodderTakeByMemo", query = "select myFodderTake from FodderTake myFodderTake where myFodderTake.memo = ?1"),
		@NamedQuery(name = "findFodderTakeByMemoContaining", query = "select myFodderTake from FodderTake myFodderTake where myFodderTake.memo like ?1"),
		@NamedQuery(name = "findFodderTakeByPrimaryKey", query = "select myFodderTake from FodderTake myFodderTake where myFodderTake.id = ?1"),
		@NamedQuery(name = "findFodderTakeByQuantity", query = "select myFodderTake from FodderTake myFodderTake where myFodderTake.quantity = ?1"),
		@NamedQuery(name = "findFodderTakeByTime", query = "select myFodderTake from FodderTake myFodderTake where myFodderTake.time = ?1") })

@Table(catalog = "pig", name = "fodder_take")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "pigRs/cn/edu/scau/cmi/hombio/domain", name = "FodderTake")

public class FodderTake implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "Id", nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@Id @GeneratedValue
	@XmlElement
	Integer id;
	/**
	* ÿһ����ȡ���ϵľ�������
	* 
	 */

	@Column(name = "Quantity", scale = 2, precision = 10, nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	BigDecimal quantity;
	/**
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "Time", nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	Calendar time;
	/**
	 */

	@Column(name = "Memo")
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	String memo;

	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "EmployeeId", referencedColumnName = "Id", nullable = false) })
	@XmlTransient
	Employee employeeByEmployeeId;
	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "TaskId", referencedColumnName = "Id", nullable = false) })
	@XmlTransient
	Task task;
	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "FodderTypeId", referencedColumnName = "Id", nullable = false) })
	@XmlTransient
	FodderType fodderType;
	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "WarehousekepperId", referencedColumnName = "Id") })
	@XmlTransient
	Employee employeeByWarehousekepperId;

	/**
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 */
	public Integer getId() {
		return this.id;
	}

	/**
	* ÿһ����ȡ���ϵľ�������
	* 
	 */
	public void setQuantity(BigDecimal quantity) {
		this.quantity = quantity;
	}

	/**
	* ÿһ����ȡ���ϵľ�������
	* 
	 */
	public BigDecimal getQuantity() {
		return this.quantity;
	}

	/**
	 */
	public void setTime(Calendar time) {
		this.time = time;
	}

	/**
	 */
	public Calendar getTime() {
		return this.time;
	}

	/**
	 */
	public void setMemo(String memo) {
		this.memo = memo;
	}

	/**
	 */
	public String getMemo() {
		return this.memo;
	}

	/**
	 */
	public void setEmployeeByEmployeeId(Employee employeeByEmployeeId) {
		this.employeeByEmployeeId = employeeByEmployeeId;
	}

	/**
	 */
	@JsonIgnore
	public Employee getEmployeeByEmployeeId() {
		return employeeByEmployeeId;
	}

	/**
	 */
	public void setTask(Task task) {
		this.task = task;
	}

	/**
	 */
	@JsonIgnore
	public Task getTask() {
		return task;
	}

	/**
	 */
	public void setFodderType(FodderType fodderType) {
		this.fodderType = fodderType;
	}

	/**
	 */
	@JsonIgnore
	public FodderType getFodderType() {
		return fodderType;
	}

	/**
	 */
	public void setEmployeeByWarehousekepperId(Employee employeeByWarehousekepperId) {
		this.employeeByWarehousekepperId = employeeByWarehousekepperId;
	}

	/**
	 */
	@JsonIgnore
	public Employee getEmployeeByWarehousekepperId() {
		return employeeByWarehousekepperId;
	}

	/**
	 */
	public FodderTake() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(FodderTake that) {
		setId(that.getId());
		setQuantity(that.getQuantity());
		setTime(that.getTime());
		setMemo(that.getMemo());
		setEmployeeByEmployeeId(that.getEmployeeByEmployeeId());
		setTask(that.getTask());
		setFodderType(that.getFodderType());
		setEmployeeByWarehousekepperId(that.getEmployeeByWarehousekepperId());
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("id=[").append(id).append("] ");
		buffer.append("quantity=[").append(quantity).append("] ");
		buffer.append("time=[").append(time).append("] ");
		buffer.append("memo=[").append(memo).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((id == null) ? 0 : id.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof FodderTake))
			return false;
		FodderTake equalCheck = (FodderTake) obj;
		if ((id == null && equalCheck.id != null) || (id != null && equalCheck.id == null))
			return false;
		if (id != null && !id.equals(equalCheck.id))
			return false;
		return true;
	}
}
